package com.xiaodeng.xdblogspringboot.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xiaodeng.xdblogspringboot.anno.State;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.URL;


import javax.persistence.Transient;
import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Article {
    private Integer id;
    @NotBlank(message = "标题不能为空")
    private String title;
    @NotBlank(message = "文章内容不能为空")
    private String content;
    @URL
    private String coverImg;
    @State
    private String state;
    private Integer viewCount;
    private Integer createUser;
    @JsonFormat(pattern = "yyy-MM-dd HH:mm")
    private LocalDateTime createTime;
    @JsonFormat(pattern = "yyy-MM-dd HH:mm")
    private LocalDateTime updateTime;
    @Transient
    private String categoryName; //非数据库字段
    @Transient
    private String username; //非数据库字段
}
